//
//  picRecodeViewController.h
//  picRecodeDemo
//
//  Created by glendale on 13-6-18.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "recordViewController.h"
#import "mm_subViewForPicRecode.h"
#import "mm_popupEditViewController.h"
#import "UIViewController+MJPopupViewController.h"
#import "MainMenuDataModel.h"
#import "HelpClass.h"
//#import "lame.h"
#import "webConfig.h"
#import "webService.h"
#import "AppDelegate.h"
#import "SVProgressHUD.h"

@protocol picRecodeViewControllerDelegate <NSObject>

@optional
-(void)defectListChanged;

@end

@interface picRecodeViewController : UIViewController<UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIGestureRecognizerDelegate,mm_messageBoxProtocol,mm_subViewForPicRecodeDelegate>
{
    mm_subViewForPicRecode *subViewDis;
    mm_popupEditViewController *popEditViewDis;
    UIImageView *remarkImgView;
    
    //标记是修改（2）还是新增（1）
    NSInteger nTag;
    
    //编辑标记点的messageBox
    UIAlertView *_alertViewForFaultyMark;
    
    /*
     退出缺陷标记弹出框的flag
     如果由确定退出的就是字符串@"quitFromOKBtn"
     如果由旁边的阴影部分退出就是字符串@"quitFromFade"
     */
    NSString *_strForQuitPopUpViewFlag;
}

@property (strong, nonatomic) IBOutlet UIScrollView *scrollViewDis;
@property(nonatomic, strong)recordViewController *recordViewCon;
@property(nonatomic, strong)IBOutlet UIImageView*imageView;
@property(nonatomic, strong)IBOutlet UIImageView *TapImgView;

/** 是否可以编辑 */
@property(nonatomic,assign)BOOL canEdit;
@property(nonatomic,weak)id<picRecodeViewControllerDelegate> delegate;

@property(nonatomic)CGPoint currentPoint;
@property(nonatomic,strong)NSString *defectType;

- (IBAction)ABtnSelect:(id)sender;
- (IBAction)DBtnSelect:(id)sender;
- (IBAction)HBtnSelect:(id)sender;
- (IBAction)LBtnSelect:(id)sender;
- (IBAction)PBtnSelect:(id)sender;
- (IBAction)XBtnSelect:(id)sender;

//点击回调方法
-(void)SelectTap:(UITapGestureRecognizer*)recognizer;


/*拍照和录音*/
-(IBAction)popBtn:(id)sender;

- (IBAction)recodeBtn:(id)sender;
- (IBAction)playBtn:(id)sender;
- (IBAction)backSelect:(id)sender;

-(NSString*)imageFileTextPath:(NSString*)imageName;
-(BOOL)writeImage:(UIImage*)image toFileAtPath:(NSString*)aPath;
-(UIImage *)resizeCImage:(UIImage *)image toSize:(CGSize)size;

/*end of 拍照和录音*/

//将音频文件转换成.mp3格式
-(void)audioToMp3FromAudioPathOri:(NSString *)audioPathOri toAudioPathMp3:(NSString *)audioPathMp3;
-(void)audioToMp3;

//注册消息
-(void)addAllObserver;
//移除消息
-(void)removeAllObserver;

//图片上传接口的回调方法
-(void)addImgToServer:(NSNotification *)notification;
//录音上传接口的回调方法
-(void)addAudioToServer:(NSNotification *)notification;

//测试接口
-(void)testUpLoad;
//上传mp3录音文件
-(void)uploadMp3FileToServer;

//缺陷点编辑
- (IBAction)editFaultyPointBtnPressed:(UIButton *)sender;

//压缩图片
+ (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize;

//将故障点中的所有图片拿出来组成一个行的列表
-(NSArray *)arrPicsInOutCheckList;
//通过传入的索引 i 返回故障点中图片的名字STR
-(NSString *)returnImageNameFromOutCheckListByImageIndex:(NSInteger)indexXingCan;

//弹出缺陷编辑的popUpView
-(void)faultyPointQuitPopUpView:(NSNotification *)notification;

@end
